package org.trinity.netdisk.service;

import org.springframework.http.HttpHeaders;
import org.springframework.web.multipart.MultipartFile;
import org.trinity.netdisk.bo.CheckUserFileDo;
import org.trinity.netdisk.entity.FileType;
import org.trinity.netdisk.entity.UserFile;
import org.trinity.netdisk.vo.allFile.FileVO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public interface IFileService {
    List<FileVO> getFileByUserIdAndDirId(Long userId, Long dirId);

    List<FileType> selectAllFileType();

    Long selectUserFileUsage(Long userId);

    UserFile selectUserFileByIdAndUserId(Long userId, Long userFileId);

    void createDir(UserFile userFile);

    void deleteFile(UserFile userFile);

    void deleteFileFromRecycleBin(UserFile userFile);

    void recoverFromRecycleBin(UserFile userFile);

    void deleteFileFromRecycleBinByUserFileId(Long userFileId);

    List<FileVO> getFileFromRecycleBinByUserIdAndDirId(Long userId, Long dirId);

    Object uploadFileChunk(Long userId, MultipartFile uploadedChunk,String fileName, String fileMd5, Long fileSize, Integer chunkIndex, String chunkMd5,Long parentId, String token);

    Object flashDetection(Long userId, String fileMd5, Long fileParentId, String fileName, String token);

    Integer chunkHandler(String md5, Long size);

    CheckUserFileDo getFilePath(Long userFileId , Long userId);

    void renameUserFile(UserFile userFile);

    void moveUserFile(UserFile userFile);

    void download(Long userFileId, HttpServletResponse response, HttpHeaders httpHeaders, String token) throws IOException;

    List<FileVO> searchFile(Long userId, String filename);

    void copy(Long userFileId, Long userId, Long target);
}
